#!/bin/bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.

rm -f /usr/bin/@@NAME@@

if [ -d /home/${SUDO_USER}/.config/Kylin-Code/installconfig ]; then
	find "/home/${SUDO_USER}/.config/Kylin-Code/installconfig" -mindepth 1 -maxdepth 1 ! -name 'log' -exec rm -rf {} +
fi

# Update mimetype database for removed workspace mimetype
if hash update-mime-database 2>/dev/null; then
	update-mime-database /usr/share/mime
fi

case "$1" in
	purge|P)
		rm -rf /home/${SUDO_USER}/.config/Kylin-Code
		rm -rf /home/${SUDO_USER}/.kylin-code
	;;
esac
